package thread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: tao
 * Date: 2023-11-22
 * Time: 9:26
 */
class MyThread extends Thread {
    @Override
    public void run() {
        System.out.println("hello thread1");
    }
    String name;
    public MyThread(String name) {
        super(name);
        this.name = name;
    }
}
public class ThreadDemo1 {
    public static void main(String[] args) {
        Thread t1 = new MyThread("这是我的线程");
        t1.start();
        Thread t2 = new Thread("这是我的线程"){
            @Override
            public void run() {
                System.out.println("hello thread2");
            }
        };
        t2.start();
    }
}
